import {Component, OnInit} from '@angular/core';
import {BasePage} from '../../common/basePage';
import {ActivatedRoute} from '@angular/router';
import {NavController, ToastController} from '@ionic/angular';
import {HttpService} from '../../services/http.service';
import {UrlAndOPT} from '../../common/url-and-opt.enum';

@Component({
  selector: 'app-user-lend-bill',
  templateUrl: './user-lend-bill.page.html',
  styleUrls: ['./user-lend-bill.page.scss'],
})
export class UserLendBillPage extends BasePage implements OnInit {

  title: string;
  bidNo: string;
  dataList: any[] = [];

  constructor(
    public navCtrl: NavController,
    public toastCtrl: ToastController,
    private routeInfo: ActivatedRoute,
    private service$: HttpService
  ) {
    super(navCtrl, toastCtrl);
  }

  ngOnInit() {
    this.title = this.routeInfo.snapshot.params['title'];
    this.bidNo = this.routeInfo.snapshot.params['bidNo'];
    const params = {investId: this.routeInfo.snapshot.params['investId']};
    this.service$.doRequest(UrlAndOPT.auth_user_lend_bill, params)
      .subscribe(obj => {
        if (obj && obj['billList']) {
          this.dataList = obj['billList'];
        }
      });
  }

}
